package game.objects.weapons 
{
	import flash.geom.Point;
	import game.objects.weapons.projectiles.CannonBall;
	/**
	 * ...
	 * @author rnk
	 */
	public class CannonWeapon extends Weapon
	{
		private var cannonBall:CannonBall;
		
		public function CannonWeapon() 
		{
			
		}
		
		override public function Fire(fireSolution:Object):void 
		{
			var fireAngle:Number = fireSolution.angle;
			var firePower:Number = fireSolution.power;
			var fireX:Number = fireSolution.x;
			var fireY:Number = fireSolution.y;
			
			cannonBall = new CannonBall();
			cannonBall.weapon = this;
			cannonBall.x = fireX;
			cannonBall.y = fireY;
			cannonBall.velocity.x = Math.cos(fireAngle) * firePower/7;
			cannonBall.velocity.y = Math.sin(fireAngle) * firePower/7;
			tower.world.add(cannonBall);
			
		}
		
		override public function Update():void 
		{
			super.Update();
			
			
		}
		
		override public function Die():void 
		{
			super.Die();
			
		}
		
		public function CannonBallExploded():void
		{
			cannonBall = null;
			tower.WeaponFinished();
		}
		
	}

}